function islogin() {
  //判断是否已经登录了
  let username = sessionStorage.getItem('username') || localStorage.getItem('username');
  if (!username) {
    location.href = '/pages/login.html';
  } else {
    $("#currentUser").html(username);
  }
}

islogin();

$("#logout").click(function () {
  sessionStorage.removeItem('username');
  localStorage.removeItem('username');
  islogin();
})